package com.lmk.mkcc.web.controller;

import com.lmk.mkcc.dto.SmsCodeDto;
import com.lmk.mkcc.result.JSONResult;
import com.lmk.mkcc.service.IVerifyCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

// 验证码接口类  /verifyCode/image/
@RestController
@RequestMapping("/verifycode")
public class VerifyCodeController {
    @Autowired
    private IVerifyCodeService iVerifyCodeService;


    @GetMapping("/imageCode/{imageCodeKey}")
    public JSONResult image(@PathVariable("imageCodeKey") String imageCodeKey){
        String base64ImageCode = iVerifyCodeService.image(imageCodeKey);
        return JSONResult.success(base64ImageCode);
    }
    //发送手机验证码
    @PostMapping("/sendSmsCode")
    public JSONResult sendSmsCode(@RequestBody SmsCodeDto smsCodeDto){
            iVerifyCodeService.sendSmsCode(smsCodeDto);
            return JSONResult.success();
    }

}
